Vue.component('like',{

	template:'#like-tpl',
	data:function(){
		return {
			like_count:10,
			liked:false,
		}
	},
	methods:{

		toggleLike:function(){
			if (!this.liked) {
				this.like_count++;
				this.liked = ! this.liked;
			}else{
				this.like_count--;
				this.liked = ! this.liked;
			}
		}
	}
});

//2 给组件一个生存的域
new Vue({
	el:'#app',
});